﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HouseAgencySite.Models;

namespace HouseAgencySite.Service
{
    public class FileService
    {
        private AgencyDBContext db = new AgencyDBContext();

        /// <summary>
        /// 添加文件
        /// </summary>
        /// <param name="files"></param>
        /// <returns></returns>
        public bool AddFile(Files files)
        {
            try
            {
                bool result = false;
                db.Files.Add(files);
                int num = db.SaveChanges();
                if (num > 0)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}